<template>
	<div class="articledetail">
		<van-nav-bar :title="title" fixed left-arrow @click-left="back" />

		<div class="content">
			<div class="list">
				<div class="title">
					{{detail.title}}
				</div>
				<p class="time">来源：{{detail.resource}}</p>
				<p class="source">
					<span>时间：{{detail.publishtime_text}}</span>
					<span>浏览次数：{{detail.reading}}次</span>
				</p>
				<div class="text-html" v-html="detail.postcontent"></div>

			</div>


		</div>
		<Comment ref="comment"></Comment>
		
	</div>
</template>

<script>
	import Comment from "@/views/ask/comment.vue"
	export default {
		name: "articleDetail",
		components: {
			Comment
		},
		data() {
			return {
				// title: this.$route.query.title,
				title: "详情页",
				detail:{}


			}
		},
		mounted() {
			this.$api.my.detail({asking_id:this.$route.query.id}).then(res => {
				// 执行某些操作
				if (res.code == 1) {
					this.detail = res.data
					this.$refs.comment.getList(res.data.id)
				}
			
			})
		},
		methods: {
			back() {
				this.$router.go(-1)
			}
		}


	}
</script>

<style scoped lang="less">
	.articledetail {
		padding-top: 46px;
		overflow: hidden;

		.van-nav-bar {
			.van-icon {
				color: #000;
			}

			.van-nav-bar__text {
				color: #5C5C5C;
			}
		}

		.content {
			background: #fff;
			margin-top: 0.59rem;
			padding: 1.19rem 0.94rem;

			.list {
				margin-bottom: 1rem;
				// border-bottom: 1px solid #eee;
			}

			.title {
				display: flex;
				align-items: flex-start;
				justify-content: flex-start;
				font-size: 0.94rem;
				font-family: PingFang SC;
				font-weight: bold;
				color: rgba(38, 38, 38, 1);
				line-height: 1.25em;


			}

			.time {
				font-size: 0.75rem;
				font-family: PingFang SC;
				font-weight: 500;
				color: rgba(147, 147, 147, 1);
				margin-top: 1.03rem;
				padding-bottom: 0.81rem;
				border-bottom: 1px solid rgba(238, 238, 238, 1);
			}

			.source {
				margin-top: 1.09rem;

				span {
					font-size: 0.75rem;
					font-family: PingFang SC;
					font-weight: 500;
					color: rgba(147, 147, 147, 1);
					margin-right: 1.78rem;
				}
			}

			.text-html {
				font-size: 0.81rem;
				font-family: PingFang SC;
				font-weight: 500;
				color: rgba(54, 54, 54, 1);
				margin-top: 1.84rem;
				line-height: 1.25rem;
				img{
					max-width: 100%;
				}
			}


		}

	}
</style>
